﻿namespace BancoIdeal.Public
{
    using System;
    using System.Collections.Generic;
    using System.Web.Script.Serialization;
    using System.Web.UI.WebControls;

    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            ClientesWSServiceReference.ClientesWSSoapClient wsCliente = new ClientesWSServiceReference.ClientesWSSoapClient();
            string retorno = wsCliente.GetClienteXUsuarioYClave(Login1.UserName, Login1.Password);
            if (!string.IsNullOrWhiteSpace(retorno) && retorno != "null")
            {
                this.Session["cliente"] = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(retorno);
                e.Authenticated = true;
            }
            else
            {
                e.Authenticated = false;
            }
        }
    }
}